<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>{$Think.config.web.navtiveunicode.title}</title>
    <meta name="applicable-device" content="pc,mobile"/>
    <meta http-equiv="Cache-Control" content="no-transform"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="keywords" content="{$Think.config.web.navtiveunicode.keywords}"/>
    <meta name="description" content="{$Think.config.web.navtiveunicode.description}"/>
    <meta name="renderer" content="webkit"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <link rel="icon" href="/favicon.ico" mce_href="/favicon.ico" type="image/x-icon"/>
    <link href="/static/style/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="/static/style/tool.css" rel="stylesheet" type="text/css"/>
    <!--[if lt IE 9]>
    <script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
    <script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    {:$Think.config.web.header}
</head>
<body>
{include file="header" /}
<div class="container">
    <div class="row">
        <div class="col-md-12 col10main">
            <div class="accordion" id="accordion2">
                <div class="accordion-group">
                    <ul class="nav nav-tabs hbflag">
                        <li role="presentation"><a href="/img2base64/"> 图片转Base64</a></li>
                        <li role="presentation"><a href="/utf8/">UTF-8转GBK</a></li>
                        <li role="presentation"><a href="/unicode/">Unicode/ASCII转换</a></li>
                        <li role="presentation"><a href="/ascii/">ASCII编码/解码</a></li>
                        <li role="presentation"><a href="/urlencode/">URL编码/解码</a></li>
                        <li role="presentation" class="active"><a href="/navtiveunicode/">Native/Unicode编码转换</a></li>
                        <li role="presentation"><a href="/keyboardcode/">KeyCode键盘按键码</a></li>
                        <li role="presentation" class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown"
                                                                    href="javascript:;" role="button"
                                                                    aria-haspopup="true" aria-expanded="false">更多工具<span
                                class="caret"> </span></a>
                            <ul class="dropdown-menu">
                                <li role="presentation"><a href="/androidkeycode/">Android按键码</a></li>
                                <li role="presentation"><a href="/keyboardtest/">键盘测试工具</a></li>
                            </ul>
                        </li>
                    </ul>
                    <div class="panel">
                        <form id="form1" class="form-horizontal" method="post">
                            <div class="form-group">
                                <div class="col-sm-12"><textarea onmouseover="this.focus();" id="content" name="content"
                                                                 class="form-control" rows="10"
                                                                 placeholder="请输入要转换的文本"></textarea></div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-12 text-center">
                                    <button type="button" id="encode" class="btn btn-success"
                                            onclick="javascript:Native2Unicode();">Native转Unicode
                                    </button>
                                    <button type="button" id="decode" class="btn btn-success"
                                            onclick="javascript:Unicode2Native();">Unicode转Native
                                    </button>
                                    <span id="copyallcode" class="btn btn-default"
                                          data-clipboard-target="#result">复制结果</span><input type="button"
                                                                                            onclick="ClearAll();"
                                                                                            value="清空"
                                                                                            class="btn btn-default">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-12">
                                    <pre><code id="result"></code></pre>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="accordion-group">
                    <div class="in collapse bs-docs-demoexample"><h4>Native/Unicode编码在线转换工具</h4>
                        <p>该工具提供Native与Unicode编码的在线转换功能。</p></div>
                </div>
                <div class="accordion-group"></div>
            </div>
        </div>
    </div>
</div>
<script src="/static/script/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="/static/script/bootstrap.min.js" type="text/javascript"></script>
<script src="/static/script/tool.js" type="text/javascript"></script>
<script src="/static/script/hightout.js"></script>
<script type="text/javascript">
    //Native 转换 Unicode
    function Native2Unicode() {var a_s=$("#content").val();var out='';if ('' == a_s) { alert('请输入Native字符串'); return; }for (var i=0; i<$("#content").val().length; i++)out = out + '&#' + a_s.charCodeAt(i) + ';';hightout(out);}
    //Unicode 转换 Native
    function Unicode2Native() { var a_s=$("#content").val();var code = a_s.match(/&#(\d+);/g);var out='';if (code == null) { alert('请输入正确的Unicode代码！'); $("#content").focus();return; }for (var i=0; i<code.length; i++)out = out +  String.fromCharCode(code[i].replace(/[&#;]/g, ''));hightout(out);}
</script>
{include file="nav" /}
{include file="footer" /}
</body>
</html>